/* 스케줄 작업 결과*/
function initGridScheWorkResult() {
	$("#gridList").jqGrid({
		url:'getJqgridManage1List.jsp',
		mtype: 'post',
		//postData: {  },
		datatype: "json",
		colNames:['시간','작업','결과'],
		colModel:[
				{name:'time',index:'time', width:150,align:"center",key:true},
				{name:'work',index:'work',width:170,align:"center"},
				{name:'result',index:'result', width:100,align:"center"}
			],
		rowList: [0,5,10,15,20],
		//rowNum:100,
		height:200,
		width:100,
		autowidth : true,
		sortname: "time",
		sortorder: 'DESC',
		viewrecords: true,
		multiselect: false,//앞에 체크박스처리
		multikey: "",//multikey: "ctrlKey/shiftKey",
		pager: false,
      
		onSelectRow: function(id){  //row가 선택되었을 경우
		},
		loadComplete : function(data){
        },
		loadError : function(xhr,st,err) {
			//jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
		},
		emptyrecords: "데이터가 존재하지 않습니다.",
		caption:'테이블',
		jsonReader: {
			repeatitems:false
		}
	});
	$("#gridList").jqGrid('navGrid','#pager_id',{edit:false,add:false,del:false,search:true});
}

/* 계정 신청 내역*/
function initGridAccountReqList() {
	$("#gridList2").jqGrid({
		url:'getJqgridManage2List.jsp',
		mtype: 'post',
		//postData: {  },
		datatype: "json",
		colNames:['사용자','시스템명','계정','요청일'],
		colModel:[
				{name:'user',index:'user', width:50,align:"center",key:true},
				{name:'system_name',index:'system_name', width:50,align:"center"},
				{name:'account',index:'account', width:50,align:"center"},
				{name:"req_date",index:'req_date', width:100,align:"center"}
			],
		rowList: [0,5,10,15,20],
		//rowNum:5,
		height:200,
		width:100,
		autowidth : true,
		sortname: "worker",
		sortorder: 'DESC',
		viewrecords: true,
		multiselect: false,//앞에 체크박스처리
		multikey: "",//multikey: "ctrlKey/shiftKey",
		pager: '#pager_id',
      
		onSelectRow: function(id){  //row가 선택되었을 경우
		},
		loadComplete : function(data){

        },
		loadError : function(xhr,st,err) {
			//jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
		},
		emptyrecords: "데이터가 존재하지 않습니다.",
		caption:'테이블',
		jsonReader: {
			repeatitems:false
		}
	});
	$("#gridList2").jqGrid('navGrid','#pager_id',{edit:false,add:false,del:false,search:true});
}


/* 로그온 세션*/
function initGridLoginSession() {
	$("#gridList3").jqGrid({
		url:'getJqgridManage3List.jsp',
		mtype: 'post',
		//postData: {  },
		datatype: "json",
		colNames:['시간','작업','결과'],
		colModel:[
				{name:'time',index:'time', width:50,align:"center",key:true},
				{name:'work',index:'work', width:50,align:"center"},
				{name:'result',index:'result', width:50,align:"center"}
			],
		rowList: [0,5,10,15,20],
		//rowNum:5,
		height:200,
		width:100,
		autowidth : true,
		sortname: "worker",
		sortorder: 'DESC',
		viewrecords: true,
		multiselect: false,//앞에 체크박스처리
		multikey: "",//multikey: "ctrlKey/shiftKey",
		pager: '#pager_id',
      
		onSelectRow: function(id){  //row가 선택되었을 경우
		},
		loadComplete : function(data){
			
        },
		loadError : function(xhr,st,err) {
			//jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
		},
		emptyrecords: "데이터가 존재하지 않습니다.",
		caption:'테이블',
		jsonReader: {
			repeatitems:false
		}
	});
	$("#gridList3").jqGrid('navGrid','#pager_id',{edit:false,add:false,del:false,search:true});
}


/* 비밀번호 변경 추적 */
function initGridPwChangeTrace() {
	$("#gridList4").jqGrid({
		url:'getJqgridManage4List.jsp',
		mtype: 'post',
		//postData: {  },
		datatype: "json",
		colNames:['시간','작업','결과'],
		colModel:[
				{name:'time',index:'time', width:50,align:"center",key:true},
				{name:'work',index:'work', width:50,align:"center"},
				{name:'result',index:'result', width:50,align:"center"}
			],
		rowList: [0,5,10,15,20],
		//rowNum:5,
		height:200,
		width:100,
		autowidth : true,
		sortname: "worker",
		sortorder: 'DESC',
		viewrecords: true,
		multiselect: false,//앞에 체크박스처리
		multikey: "",//multikey: "ctrlKey/shiftKey",
		pager: '#pager_id',
      
		onSelectRow: function(id){  //row가 선택되었을 경우
		},
		loadComplete : function(data){

        },
		loadError : function(xhr,st,err) {
			//jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
		},
		emptyrecords: "데이터가 존재하지 않습니다.",
		caption:'테이블',
		jsonReader: {
			repeatitems:false
		}
	});
	$("#gridList4").jqGrid('navGrid','#pager_id',{edit:false,add:false,del:false,search:true});
}


/* 작업 로그*/
function initGridWorkLog() {
	$("#gridList5").jqGrid({
		url:'getJqgridManage5List.jsp',
		mtype: 'post',
		//postData: {  },
		datatype: "json",
		colNames:['시간','작업','결과','작업자'],
		colModel:[
				{name:'time',index:'time', width:50,align:"center",key:true},
				{name:'work',index:'work', width:50,align:"center"},
				{name:'result',index:'result', width:50,align:"center"},
				{name:"worker",index:'worker', width:100,align:"center"}
			],
		rowList: [0,5,10,15,20],
		//rowNum:5,
		height:200,
		width:100,
		autowidth : true,
		sortname: "worker",
		sortorder: 'DESC',
		viewrecords: true,
		multiselect: false,//앞에 체크박스처리
		multikey: "",//multikey: "ctrlKey/shiftKey",
		pager: '#pager_id',
      
		onSelectRow: function(id){  //row가 선택되었을 경우
		},
		loadComplete : function(data){

        },
		loadError : function(xhr,st,err) {
			//jQuery("#rsperror").html("Type: "+st+"; Response: "+ xhr.status + " "+xhr.statusText);
		},
		emptyrecords: "데이터가 존재하지 않습니다.",
		caption:'테이블',
		jsonReader: {
			repeatitems:false
		}
	});
	$("#gridList5").jqGrid('navGrid','#pager_id',{edit:false,add:false,del:false,search:true});
}

var lastsel3;
$(document).ready(function(){
	initGridScheWorkResult();//스케줄 작업 결과
	initGridAccountReqList();//계정 신청 내역
	initGridLoginSession();//로그온 세션
	initGridPwChangeTrace();//비밀번호 변경 추적
	initGridWorkLog();//작업 로그

	$(".btn_go").on("click",function() {
		var clickId = $(this).attr("id").replace("_more","");
		$("ul.depth_1 > li > a > img").each(function( index ) {
			var menuId = $(this).attr("id");
			if( clickId == menuId ) {
				$(this).click();
			}
		});
	});
});
